﻿using AIStudio.Wpf.BasePage.Events;
using Prism.Events;
using Util.Controls;

namespace AIStudio.Wpf.Client.Views
{
    /// <summary>
    /// LoginWindow.xaml 的交互逻辑
    /// </summary>
    public partial class LoginWindow : WindowBase
    {
        IEventAggregator _eventAggregator { get; }
        public LoginWindow(IEventAggregator eventAggregator)
        {            
            InitializeComponent();

            _eventAggregator = eventAggregator;
            _eventAggregator.GetEvent<LoginSentEvent>().Subscribe(LoginSentEventReceived);
        }

        private void LoginSentEventReceived(bool loginState)
        {
            if (loginState == true)
            {
                this.DialogResult = loginState;
                this.Close();
            }
        }
    }
}
